package com.bit.springiocdemo.controller;

import com.bit.springiocdemo.config.UserConfig;
import com.bit.springiocdemo.model.UserInfo;
import com.bit.springiocdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

@Controller
public class UserController2 {
    private UserService userService;

    private UserConfig userConfig;

    private UserInfo userInfo;

//    public UserController2() {
//    }
//
//    @Autowired
//    public UserController2(UserService userService){
//        this.userService = userService;
//    }

    public UserController2(UserService userService, UserConfig userConfig) {
        this.userService = userService;
        this.userConfig = userConfig;
    }

    @Autowired
    public UserController2(UserService userService, UserConfig userConfig,@Qualifier("user1") UserInfo userInfo) {
        this.userService = userService;
        this.userConfig = userConfig;
        this.userInfo = userInfo;
    }

    public void sayHi() {
        userService.doService();
        userConfig.doConfig();
        System.out.println("UserController.sayHi");
    }
}
